<template>
    <div class="header">
      <van-icon style="font-weight: bold;" @click="back" name="arrow-left" />
      <div :style="{textAlign: position}" style="flex: 2; font-weight: bold" v-if="title" class="title">{{title}}</div>
      <div class="option"><slot></slot></div>
    </div>
</template>

<script>
import {Icon} from 'vant'
    export default {
        components: {
          [Icon.name]: Icon
        },
        props: {
            title: {
                default: '',
                type: String
            },
            position: {
                default: 'center',
                type: String
            },
            showback: {
                default: true,
                type: Boolean
            }
        },
      methods: {
        back() {
          this.$router.go(-1)
        }
      }

    }
</script>

<style lang="less" scoped>
.header {
  font-weight: bold;
  display: flex;
  align-items: center;
  position: relative;
  text-align: left;
  padding: 14px;
  overflow: hidden;
  background: #ffffff;
  box-sizing: border-box;
  font-size: 16px;
  color: #175FB3;
  z-index: 101;
  .titlecenter {
    text-align: center;;
  }
}
</style>
